<!DOCTYPE html>
<html>
<head>
    <% include ../include/css_header.html %>
    <style>
    </style>
</head>
<body class="actlist_bg">
<div class="container">
    <div class="row">
        <div style="position: fixed;top: 10px;z-index: 10;" class="col-xs-12">
            <a class="icon-arrow-left" style="color: #ffffff;font-size: 24px;" href="/faction/<%=factionId %>"></a>
        </div>
    </div>
    <div style="height: 20px;"></div>
    <div class="font_shadow_133000" style="text-align: center;color: #ffffff;">
        <h3><strong><%=goods.name %></strong></h3>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="bg_op_panel" style="padding: 15px">
                <div class="bg_white_panel">
                    <img src="/goods/<%=factionId %>_<%=goods._id%>.jpg" class="" style="width: 285px;"/>
                    <hr>
                    <ul>
                        <li><h4><strong><%=goods.name %></strong></h4></li>
                        <li>价值: <strong style="color: #FE8125"><%=goods.price %></strong> 快乐镑</li>
                        <li>数量：<%=goods.count %></li>
                    </ul>
                    <hr>
                    <p><%=goods.description %></p>
                    <button type="button" class="btn btn-lg btn-warning btn-block" id="payBtn">马上支付</button>
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" id="factionId" value="<%=factionId %>">
    <input type="hidden" id="goodsId" value="<%=goods._id %>">
    <input type="hidden" id="goodsName" value="<%=goods.name %>">
    <input type="hidden" id="price" value="<%=goods.price %>">
    <% include ../include/copyright.html %>
</div>
<% include ../include/js_footer.html %>
<script>
    $(function(){
        $('#payBtn').click(function(){
            var params = {
                factionId: $('#factionId').val(),
                goodsId: $('#goodsId').val(),
                goodsName: $('#goodsName').val(),
                totalFee: $('#price').val()
            }
            $.post('/createOrder', params, function(res){
                if(res.error) return AlertBox.showTip('服务器繁忙...');
                var order = res.order;
                window.location.href = '/showOrder/'+order._id
            })
        })
    })
</script>
</body>
</html>